package com.spring.service.util;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;

import com.spring.domain.RelContImg;

public class RelContImgMapper implements ParameterizedRowMapper<RelContImg>{
	 public RelContImg mapRow(ResultSet rs, int rowNum) throws SQLException {
		 RelContImg obj = new RelContImg();
		 obj.setId(rs.getInt("id"));
		 obj.setId_cont(rs.getInt("id_cont"));
		 obj.setId_file(rs.getInt("id_file"));
		 obj.setPosition(rs.getInt("position"));
	     return obj;
	    }
	    
	    public static MapSqlParameterSource sqlMap (RelContImg obj){
	    	return new MapSqlParameterSource()
					.addValue("id", obj.getId())
					.addValue("id_cont", obj.getId_cont())
					.addValue("id_file", obj.getId_file())
					.addValue("position", obj.getPosition());
	    }
}
